﻿using System;
using System.Web.Mvc;
using PartyInvite.Models;

namespace PartyInvite.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            var dtNow = DateTime.Now;
            ViewBag.Greeting = dtNow;
            return View();
        }

        [HttpGet]
        // invoked when the link url is clicked
        public ActionResult RsvpForm()
        {
            return View();
        }

        [HttpPost]
        // invoked when the form is submitted by Submit button click.
        public ActionResult RsvpForm(GuestResponse guestResponse)
        {
            if (ModelState.IsValid)
            {
                // TODO: email to the party organizer..
                return View("Thanks", guestResponse);
            }
            return View();
        }
    }
}
